Here's how I generate my signatures:-

Object Browser in Word
===================

Start Word and goto Tools->Macro->Visual Basic Editor
Press F2 to start the object browser
Change the library to MS-Word

Now look at the class "application" it consists of "sub", "function" and "properties" with different icons. press ? on any one will give very comprehensive help (if you installed the word basic help)

When creating the first COM signature in Uniface, implementation is COM and properties Word.Application, i.e. the object we wish to create an instance of. For reference look at Word.Application in the object browser.

The signture in the demo representing Word.Application is "WORD".


Setting Properties
==============

Look at the "visible property" in Object Browser as an example

-Setting a property is easy -- create a operation named VISIBLE in "WORD"
-Add a parameter BOOLEAN which is of type VT_BOOL
-Under details for the signature, set the literal name to be "Visible.set" with return value in $status type VT_I4

Tip : Literal name always matches Object name in word, sometime appending ".set" as in this example.


Getting Properties
================

Look at object "activedocument" in ms-word, this returns the document with focus. 

The literal name is ActiveDocument which returns a read only DOCUMENT (see word help). I have set this to the first parameter to be returned and always follow this convention as we will receive back an OBJECT POINTER to the active document wothin word.

Now create the first parameter and use a Uniface instance to hold the object pointer.
Its interface must be VT_DISPATCH as its an object. See the example below:

variables
    string opendocument
endvariables

;; THIS CREATES WORD OBJECT
activate "word".document(opendocument)

Now we can activate, operations we have created on "opendocument" but of course we have to create a signature for this object as well........so in my application its named ACTIVEDOCUMENT with implementation COM and contains a few method and properties operations.

Tip : must not forget to destroy both "opendocument" and "word" or you'll get an activation error second time.

Method (no parameters)
====================

Simple method -- see activedocument signature for example, select document in object browser

Simple method is CHECKSPELLING, no parameters. When this is activated, a dialog will be displayed asking the user to confirm spelling corrections and this will then be returned to the open document. 

Tip : To integrate this with Uniface --  save the text in your application to a txt file using filedump, open the file in word, spell check it and then resave it as a text file on the hard disk. You can use fileload to re-read it into your uniface application. Note the code uses a counter to generate unique filename so it will work in a multiuser environment.

See service S_SPELL for an example of an operation to check spelling which will work in the demo if added.


Method (with Params)
=================

SAVEAS method -- no return but values are passed, just setup parameters as required, this is really very easy.


Method (with Params and returned Object)
=================================

GOTO method -- returns a RANGE object so set range as first parameter and then add the 4 parameters the routine is expecting namely, what, which, count and name.  Note some of these are constants like WHAT and in my demo I use the constant WDGOTOLINE which is also defined as an property with the object WDGOTOITEM so you can easily see its physical setting.

So now we need a signture for RANGE if we want to do anything with the range object. If you never want to do anything with a returned object then you don't need a Uniface instance as you will not be activating operations on it. May as well just return a string which will eventually be destroyed.

So as you can see there's nothing too bad about this but it takes time to work out what you want to do and the best way of achieving it as the object structure for Word is complex. Knowledge of O-O and familiarity with word basic is very useful. 

It can be time consuming, a bit of a pain and I rarely get it right the first time (hence the demo) but the results are great.


